import request from "@/utils/request";

/**
 * 客户管理列表
 * @param { CustomManageList } params
 */
export const listManage = params => {
  return request({
    url: "/crm/info/listManage",
    method: "get",
    params
  });
};

/**
 * 分配、移交
 * @param { AssignParams } data
 */
export const clientAssign = data => {
  return request({
    url: "/crm/info/addAssign",
    method: "post",
    data
  });
};

/**
 * 当前用户可分配角色
 */
export const getAssignRole = () => {
  return request({
    url: "/crm/system/getAllAssignRoleList",
    method: "get"
  });
};

/**
 * 客户基本信息 + 跟进记录
 * @param { string } customerId
 */
export const clientInfoAndFollow = customerId => {
  return request({
    url: `/crm/info/getInfoPenetration/${customerId}`,
    method: "get"
  });
};

/**
 * 新增客户跟进
 * @param { CustomTrackAdd } data
 */
export const addTrack = data => {
  return request({
    url: "/crm/track/add",
    method: "post",
    data
  });
};

/**
 * 服务团队
 * @param { string } customerId
 * @returns { Array<ServiceTeamData> }
 */
export const getServiceTeam = customerId => {
  return request({
    url: `/crm/info/getServiceTeam/${customerId}`,
    method: "get"
  });
};

/**
 * 客户阶段列表
 * @param { string } customerId -客户ID
 * @returns { Array<ClientStageData> }
 */
export const getStageList = customerId => {
  return request({
    url: `/crm/info/stage/list/${customerId}`,
    method: "get"
  });
};

/**
 * 客户阶段——办理CRM流程任务
 * @param { string } stageTaskId -客户阶段任务ID
 * @param { TaskHandleParams } data
 */
export const subStageViewContent = (stageTaskId, data) => {
  return request({
    url: `/crm/info/transact/${stageTaskId}`,
    method: "post",
    data
  });
};

/**
 * 客户阶段内容视图
 * @param { string } customerId -客户ID
 */
export const getStageView = customerId => {
  return request({
    url: `/crm/info/stage/content/${customerId}`,
    method: "get"
  });
};
